package scau.jump.securitytrace.util;

import java.util.List;
import java.util.Vector;

import com.securitytrace.model.Role;

public class RoleConvertToVector extends ConvertAdapter<Role> {

	@Override
	public Vector<?> convertToVector(List<Role> roles) {
		if(roles == null || roles.size()<1) {
			return null;
		}
		Vector<Vector<?>> vectors = new Vector<Vector<?>>();
		for(Role role : roles) {
			if(role == null) {
				return null;
			}
			vectors.add(convertToVector(role));
		}
		return vectors;
	}

	@Override
	public Vector<?> convertToVector(Role role) {
		if(role == null) {
			return null;
		}
		Vector<String> vector = new Vector<String>();
		vector.add(role.getName());
		vector.add(role.getDescription());
		return vector;
	}

}
